$(document).ready(function () {
    var xqly = "2";
    var datas = getCgrwTotal(xqly);
    $("#wlxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.wlCgxqCounts);
    $("#gcxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.gcCgxqCounts);
    $("#zlxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.zlCgxqCounts);
    $("#ysxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.ysCgxqCounts);
    $("#fwxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.fwCgxqCounts);
    $("#wlcgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.wlCgrwCounts);
    $("#gccgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.gcCgrwCounts);
    $("#zlcgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.zlCgrwCounts);
    $("#yscgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.ysCgrwCounts);
    $("#fwcgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.fwCgrwCounts);
    $("#wlcgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#gccgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#zlcgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#yscgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#fwcgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
});

//点击PMS按钮切换页面为PMS
function getPmsInfo() {
    var wl_xj_url = '/spa/cube/index.html#/main/cube/card?type=1&modeId=83501&formId=-1067&field145491=0';
    var gc_xj_url = '/spa/cube/index.html#/main/cube/card?type=1&modeId=83502&formId=-1068&field145501=0';
    var zl_xj_url = '/spa/cube/index.html#/main/cube/card?type=1&modeId=83503&formId=-1069&field145509=0';
    var ys_xj_url = '/spa/cube/index.html#/main/cube/card?type=1&modeId=83504&formId=-1070&field145519=0';
    var fw_xj_url = '/spa/cube/index.html#/main/cube/card?type=1&modeId=83505&formId=-1066&field145482=0';
    var wl_xq_url = '/spa/cube/index.html#/main/cube/tree?id=10504';
    var wl_rw_url = '/spa/cube/index.html#/main/cube/tree?id=10523';
    var wl_jh_url = '/spa/cube/index.html#/main/cube/tree?id=11001';
    var gc_xq_url = '/spa/cube/index.html#/main/cube/tree?id=10505';
    var gc_rw_url = '/spa/cube/index.html#/main/cube/tree?id=10524';
    var gc_jh_url = '/spa/cube/index.html#/main/cube/tree?id=00000';
    var zl_xq_url = '/spa/cube/index.html#/main/cube/tree?id=10506';
    var zl_rw_url = '/spa/cube/index.html#/main/cube/tree?id=10525';
    var zl_jh_url = '/spa/cube/index.html#/main/cube/tree?id=00000';
    var ys_xq_url = '/spa/cube/index.html#/main/cube/tree?id=10507';
    var ys_rw_url = '/spa/cube/index.html#/main/cube/tree?id=10526';
    var ys_jh_url = '/spa/cube/index.html#/main/cube/tree?id=00000';
    var fw_xq_url = '/spa/cube/index.html#/main/cube/tree?id=10508';
    var fw_rw_url = '/spa/cube/index.html#/main/cube/tree?id=10527';
    var fw_jh_url = '/spa/cube/index.html#/main/cube/tree?id=00000';
    var xqly = "0";
    var datas = getCgrwTotal(xqly);
    $("#wl").children('div').eq(0).children('.info').text("[PMS]物料采购需求管理");
    $("#gc").children('div').eq(0).children('.info').text("[PMS]工程采购需求管理");
    $("#zl").children('div').eq(0).children('.info').text("[PMS]租赁采购需求管理");
    $("#ys").children('div').eq(0).children('.info').text("[PMS]运输采购需求管理");
    $("#fw").children('div').eq(0).children('.info').text("[PMS]服务采购需求管理");
    $('#wlxqc').children('.mytext').children('.subtitle').children('a').attr('href', wl_xq_url);
    $('#wlcgrw').children('.mytext').children('.subtitle').children('a').attr('href', wl_rw_url);
    $('#wlcgjh').children('.mytext').children('.subtitle').children('a').attr('href', wl_jh_url);
    $('#gcxqc').children('.mytext').children('.subtitle').children('a').attr('href', gc_xq_url);
    $('#gccgrw').children('.mytext').children('.subtitle').children('a').attr('href', gc_rw_url);
    $('#gccgjh').children('.mytext').children('.subtitle').children('a').attr('href', gc_jh_url);
    $('#zlxqc').children('.mytext').children('.subtitle').children('a').attr('href', zl_xq_url);
    $('#zlcgrw').children('.mytext').children('.subtitle').children('a').attr('href', zl_rw_url);
    $('#zlcgjh').children('.mytext').children('.subtitle').children('a').attr('href', zl_jh_url);
    $('#ysxqc').children('.mytext').children('.subtitle').children('a').attr('href', ys_xq_url);
    $('#yscgrw').children('.mytext').children('.subtitle').children('a').attr('href', ys_rw_url);
    $('#yscgjh').children('.mytext').children('.subtitle').children('a').attr('href', ys_jh_url);
    $('#fwxqc').children('.mytext').children('.subtitle').children('a').attr('href', fw_xq_url);
    $('#fwcgrw').children('.mytext').children('.subtitle').children('a').attr('href', fw_rw_url);
    $('#fwcgjh').children('.mytext').children('.subtitle').children('a').attr('href', fw_jh_url);
    // $('#wlxj').children('.mytext').children('.subtitle').children('a').attr('href', wl_xj_url);
    // $('#gcxj').children('.mytext').children('.subtitle').children('a').attr('href', gc_xj_url);
    // $('#zlxj').children('.mytext').children('.subtitle').children('a').attr('href', zl_xj_url);
    // $('#ysxj').children('.mytext').children('.subtitle').children('a').attr('href', ys_xj_url);
    // $('#fwxj').children('.mytext').children('.subtitle').children('a').attr('href', fw_xj_url);
    $('#wlxj').hide();
    $('#gcxj').hide();
    $('#zlxj').hide();
    $('#ysxj').hide();
    $('#fwxj').hide();
    $("#wlxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.wlCgxqCounts);
    $("#gcxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.gcCgxqCounts);
    $("#zlxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.zlCgxqCounts);
    $("#ysxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.ysCgxqCounts);
    $("#fwxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.fwCgxqCounts);
    $("#wlcgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.wlCgrwCounts);
    $("#gccgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.gcCgrwCounts);
    $("#zlcgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.zlCgrwCounts);
    $("#yscgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.ysCgrwCounts);
    $("#fwcgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.fwCgrwCounts);
    $("#wlcgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#gccgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#zlcgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#yscgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#fwcgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
}

//点击OA按钮切换页面为OA
function getOaInfo() {
    var wl_xj_url = '/spa/cube/index.html#/main/cube/card?type=1&modeId=83501&formId=-1067&field145491=1';
    var zl_xj_url = '/spa/cube/index.html#/main/cube/card?type=1&modeId=83503&formId=-1069&field145509=1';
    var ys_xj_url = '/spa/cube/index.html#/main/cube/card?type=1&modeId=83504&formId=-1070&field145519=1';
    var fw_xj_url = '/spa/cube/index.html#/main/cube/card?type=1&modeId=83505&formId=-1066&field145482=1';
    var wl_xq_url = '/spa/cube/index.html#/main/cube/tree?id=10509';
    var wl_rw_url = '/spa/cube/index.html#/main/cube/tree?id=10528';
    var wl_jh_url = '/spa/cube/index.html#/main/cube/tree?id=11501';
    var zl_xq_url = '/spa/cube/index.html#/main/cube/tree?id=10510';
    var zl_rw_url = '/spa/cube/index.html#/main/cube/tree?id=10529';
    var zl_jh_url = '/spa/cube/index.html#/main/cube/tree?id=00000';
    var ys_xq_url = '/spa/cube/index.html#/main/cube/tree?id=10511';
    var ys_rw_url = '/spa/cube/index.html#/main/cube/tree?id=10530';
    var ys_jh_url = '/spa/cube/index.html#/main/cube/tree?id=00000';
    var fw_xq_url = '/spa/cube/index.html#/main/cube/tree?id=10512';
    var fw_rw_url = '/spa/cube/index.html#/main/cube/tree?id=10531';
    var fw_jh_url = '/spa/cube/index.html#/main/cube/tree?id=00000';
    var xqly = "1";
    var datas = getCgrwTotal(xqly);
    $("#wl").children('div').eq(0).children('.info').text("[OA]物料采购需求管理");
    $("#gc").children('div').eq(0).children('.info').text("[OA]工程采购需求管理");
    $("#zl").children('div').eq(0).children('.info').text("[OA]租赁采购需求管理");
    $("#ys").children('div').eq(0).children('.info').text("[OA]运输采购需求管理");
    $("#fw").children('div').eq(0).children('.info').text("[OA]服务采购需求管理");
    $('#wlxqc').children('.mytext').children('.subtitle').children('a').attr('href', wl_xq_url);
    $('#wlcgrw').children('.mytext').children('.subtitle').children('a').attr('href', wl_rw_url);
    $('#wlcgjh').children('.mytext').children('.subtitle').children('a').attr('href', wl_jh_url);
    $('#gcxqc').children('.mytext').children('.subtitle').children('a').removeAttr('href');
    $('#gccgrw').children('.mytext').children('.subtitle').children('a').removeAttr('href');
    $('#zlxqc').children('.mytext').children('.subtitle').children('a').attr('href', zl_xq_url);
    $('#zlcgrw').children('.mytext').children('.subtitle').children('a').attr('href', zl_rw_url);
    $('#zlcgjh').children('.mytext').children('.subtitle').children('a').attr('href', zl_jh_url);
    $('#ysxqc').children('.mytext').children('.subtitle').children('a').attr('href', ys_xq_url);
    $('#yscgrw').children('.mytext').children('.subtitle').children('a').attr('href', ys_rw_url);
    $('#yscgjh').children('.mytext').children('.subtitle').children('a').attr('href', ys_jh_url);
    $('#fwxqc').children('.mytext').children('.subtitle').children('a').attr('href', fw_xq_url);
    $('#fwcgrw').children('.mytext').children('.subtitle').children('a').attr('href', fw_rw_url);
    $('#fwcgjh').children('.mytext').children('.subtitle').children('a').attr('href', fw_jh_url);
    // $('#wlxj').children('.mytext').children('.subtitle').children('a').attr('href', wl_xj_url);
    // $('#gcxj').children('.mytext').children('.subtitle').children('a').removeAttr('href');
    // $('#zlxj').children('.mytext').children('.subtitle').children('a').attr('href', zl_xj_url);
    // $('#ysxj').children('.mytext').children('.subtitle').children('a').attr('href', ys_xj_url);
    // $('#fwxj').children('.mytext').children('.subtitle').children('a').attr('href', fw_xj_url);
    $('#wlxj').hide();
    $('#gcxj').hide();
    $('#zlxj').hide();
    $('#ysxj').hide();
    $('#fwxj').hide();
    $("#wlxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.wlCgxqCounts);
    $("#gcxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.gcCgxqCounts);
    $("#zlxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.zlCgxqCounts);
    $("#ysxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.ysCgxqCounts);
    $("#fwxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.fwCgxqCounts);
    $("#wlcgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.wlCgrwCounts);
    $("#gccgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.gcCgrwCounts);
    $("#zlcgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.zlCgrwCounts);
    $("#yscgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.ysCgrwCounts);
    $("#fwcgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.fwCgrwCounts);
    $("#wlcgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#gccgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#zlcgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#yscgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#fwcgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
}

//点击SRM按钮切换页面为SRM
function getSrmInfo() {
    var wl_xj_url = '/spa/cube/index.html#/main/cube/card?type=1&modeId=83501&formId=-1067&field145491=2';
    var gc_xj_url = '/spa/cube/index.html#/main/cube/card?type=1&modeId=83502&formId=-1068&field145501=2';
    var zl_xj_url = '/spa/cube/index.html#/main/cube/card?type=1&modeId=83503&formId=-1069&field145509=2';
    var ys_xj_url = '/spa/cube/index.html#/main/cube/card?type=1&modeId=83504&formId=-1070&field145519=2';
    var fw_xj_url = '/spa/cube/index.html#/main/cube/card?type=1&modeId=83505&formId=-1066&field145482=2';
    var wl_xq_url = '/spa/cube/index.html#/main/cube/tree?id=10513';
    var wl_rw_url = '/spa/cube/index.html#/main/cube/tree?id=10532';
    var wl_jh_url = '/spa/cube/index.html#/main/cube/tree?id=11502';
    var gc_xq_url = '/spa/cube/index.html#/main/cube/tree?id=10514';
    var gc_rw_url = '/spa/cube/index.html#/main/cube/tree?id=10533';
    var gc_jh_url = '/spa/cube/index.html#/main/cube/tree?id=00000';
    var zl_xq_url = '/spa/cube/index.html#/main/cube/tree?id=10515';
    var zl_rw_url = '/spa/cube/index.html#/main/cube/tree?id=10534';
    var zl_jh_url = '/spa/cube/index.html#/main/cube/tree?id=00000';
    var ys_xq_url = '/spa/cube/index.html#/main/cube/tree?id=10516';
    var ys_rw_url = '/spa/cube/index.html#/main/cube/tree?id=10535';
    var ys_jh_url = '/spa/cube/index.html#/main/cube/tree?id=00000';
    var fw_xq_url = '/spa/cube/index.html#/main/cube/tree?id=10517';
    var fw_rw_url = '/spa/cube/index.html#/main/cube/tree?id=10536';
    var fw_jh_url = '/spa/cube/index.html#/main/cube/tree?id=00000';
    var xqly = "2";
    var datas = getCgrwTotal(xqly);
    $("#wl").children('div').eq(0).children('.info').text("[SRM]物料采购需求管理");
    $("#gc").children('div').eq(0).children('.info').text("[SRM]工程采购需求管理");
    $("#zl").children('div').eq(0).children('.info').text("[SRM]租赁采购需求管理");
    $("#ys").children('div').eq(0).children('.info').text("[SRM]运输采购需求管理");
    $("#fw").children('div').eq(0).children('.info').text("[SRM]服务采购需求管理");
    $('#wlxqc').children('.mytext').children('.subtitle').children('a').attr('href', wl_xq_url);
    $('#wlcgrw').children('.mytext').children('.subtitle').children('a').attr('href', wl_rw_url);
    $('#wlcgjh').children('.mytext').children('.subtitle').children('a').attr('href', wl_jh_url);
    $('#gcxqc').children('.mytext').children('.subtitle').children('a').attr('href', gc_xq_url);
    $('#gccgrw').children('.mytext').children('.subtitle').children('a').attr('href', gc_rw_url);
    $('#gccgjh').children('.mytext').children('.subtitle').children('a').attr('href', gc_jh_url);
    $('#zlxqc').children('.mytext').children('.subtitle').children('a').attr('href', zl_xq_url);
    $('#zlcgrw').children('.mytext').children('.subtitle').children('a').attr('href', zl_rw_url);
    $('#zlcgjh').children('.mytext').children('.subtitle').children('a').attr('href', zl_jh_url);
    $('#ysxqc').children('.mytext').children('.subtitle').children('a').attr('href', ys_xq_url);
    $('#yscgrw').children('.mytext').children('.subtitle').children('a').attr('href', ys_rw_url);
    $('#yscgjh').children('.mytext').children('.subtitle').children('a').attr('href', ys_jh_url);
    $('#fwxqc').children('.mytext').children('.subtitle').children('a').attr('href', fw_xq_url);
    $('#fwcgrw').children('.mytext').children('.subtitle').children('a').attr('href', fw_rw_url);
    $('#fwcgjh').children('.mytext').children('.subtitle').children('a').attr('href', fw_jh_url);
    $('#wlxj').show();
    $('#gcxj').show();
    $('#zlxj').show();
    $('#ysxj').show();
    $('#fwxj').show();
    $('#wlxj').children('.mytext').children('.subtitle').children('a').attr('href', wl_xj_url);
    $('#gcxj').children('.mytext').children('.subtitle').children('a').attr('href', gc_xj_url);
    $('#zlxj').children('.mytext').children('.subtitle').children('a').attr('href', zl_xj_url);
    $('#ysxj').children('.mytext').children('.subtitle').children('a').attr('href', ys_xj_url);
    $('#fwxj').children('.mytext').children('.subtitle').children('a').attr('href', fw_xj_url);
    $("#wlxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.wlCgxqCounts);
    $("#gcxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.gcCgxqCounts);
    $("#zlxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.zlCgxqCounts);
    $("#ysxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.ysCgxqCounts);
    $("#fwxqc").children(".mytext").children(".detail").text("未分配需求：" + datas.fwCgxqCounts);
    $("#wlcgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.wlCgrwCounts);
    $("#gccgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.gcCgrwCounts);
    $("#zlcgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.zlCgrwCounts);
    $("#yscgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.ysCgrwCounts);
    $("#fwcgrw").children(".mytext").children(".detail").text("未生成任务：" + datas.fwCgrwCounts);
    $("#wlcgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#gccgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#zlcgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#yscgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
    $("#fwcgjh").children(".mytext").children(".detail").text("未生成任务：" + 0);
}

//获取采购任务未生成个数
function getCgrwTotal(xqly) {
    var datas = {};
    $.ajax({
        async: false,
        url: '/api/weaWorkflowActionApi/getCgrwTotal',
        data: {xqly: xqly},
        type: "get",
        dataType: "json",
        success: function (data) {
            datas = data.datas;
        }, error: function (e) {
        }
    });
    return datas;
}